package cn.wenhaha.wxBox.spellbook

import com.gh0u1l5.wechatmagician.spellbook.base.EventCenter
import com.gh0u1l5.wechatmagician.spellbook.base.Hooker
import com.gh0u1l5.wechatmagician.spellbook.interfaces.IFileSystemHook
import com.gh0u1l5.wechatmagician.spellbook.interfaces.IUriRouterHook
import de.robv.android.xposed.XC_MethodHook
import de.robv.android.xposed.XposedBridge.hookMethod
import de.robv.android.xposed.XposedHelpers.findAndHookMethod

object Menu: EventCenter()  {

    override val interfaces: List<Class<*>>
        get() = listOf(IFileSystemHook::class.java)

    override fun provideStaticHookers(): List<Hooker>? {
        return listOf(onCheckSelectLimitHooker, onSelectAllContactHooker)
    }

    // Hook SelectConversationUI to bypass the limit on number of recipients.
    private val onCheckSelectLimitHooker = Hooker {
        findAndHookMethod("com.tencent.mm.ui.LauncherUI", object : XC_MethodHook() {
            @Throws(Throwable::class)
            override fun beforeHookedMethod(param: MethodHookParam) {
                param.result = false
            }
        })
    }

}